package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.EmergencyReportMapper;
import com.ruoyi.system.domain.EmergencyReport;
import com.ruoyi.system.service.IEmergencyReportService;

/**
 * 应急事件上报Service业务层处理
 *
 * @author ruoyi
 * @date 2025-10-24
 */
@Service
public class EmergencyReportServiceImpl implements IEmergencyReportService
{
    @Autowired
    private EmergencyReportMapper emergencyReportMapper;

    /**
     * 查询应急事件上报
     *
     * @param id 应急事件上报主键
     * @return 应急事件上报
     */
    @DataSource(DataSourceType.SLAVE)
    @Override
    public EmergencyReport selectEmergencyReportById(String id)
    {
        return emergencyReportMapper.selectEmergencyReportById(id);
    }

    /**
     * 查询应急事件上报列表
     *
     * @param emergencyReport 应急事件上报
     * @return 应急事件上报
     */
    @DataSource(DataSourceType.SLAVE)
    @Override
    public List<EmergencyReport> selectEmergencyReportList(EmergencyReport emergencyReport)
    {
        return emergencyReportMapper.selectEmergencyReportList(emergencyReport);
    }

    /**
     * 新增应急事件上报
     *
     * @param emergencyReport 应急事件上报
     * @return 结果
     */
    @DataSource(DataSourceType.SLAVE)
    @Override
    public int insertEmergencyReport(EmergencyReport emergencyReport)
    {
        emergencyReport.setCreateTime(DateUtils.getNowDate());
        return emergencyReportMapper.insertEmergencyReport(emergencyReport);
    }

    /**
     * 修改应急事件上报
     *
     * @param emergencyReport 应急事件上报
     * @return 结果
     */
    @DataSource(DataSourceType.SLAVE)
    @Override
    public int updateEmergencyReport(EmergencyReport emergencyReport)
    {
        emergencyReport.setUpdateTime(DateUtils.getNowDate());
        return emergencyReportMapper.updateEmergencyReport(emergencyReport);
    }

    /**
     * 批量删除应急事件上报
     *
     * @param ids 需要删除的应急事件上报主键
     * @return 结果
     */
    @DataSource(DataSourceType.SLAVE)
    @Override
    public int deleteEmergencyReportByIds(String[] ids)
    {
        return emergencyReportMapper.deleteEmergencyReportByIds(ids);
    }

    /**
     * 删除应急事件上报信息
     *
     * @param id 应急事件上报主键
     * @return 结果
     */
    @DataSource(DataSourceType.SLAVE)
    @Override
    public int deleteEmergencyReportById(String id)
    {
        return emergencyReportMapper.deleteEmergencyReportById(id);
    }
}
